# -*- coding: utf-8 -*-
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as DjangoAdmin
from django.contrib.auth.models import User
from .models import Devices, DeviceType, CustomUser

class ProfileAdmin(admin.ModelAdmin):
	list_display = ('email', 'first_name', 'last_name', 'username', 'is_staff')
	fields = ('first_name', 'last_name', 'sex', 'residence', 'device', 'description',
		'avatar', 'experience', 'gallery', 'recipes_count',)

class DevicesAdmin(admin.ModelAdmin):
	pass

class DeviceTypeAdmin(admin.ModelAdmin):
	pass

class AvatarAdmin(admin.ModelAdmin):
	pass

admin.site.register(CustomUser, ProfileAdmin)
admin.site.register(Devices, DevicesAdmin)
admin.site.register(DeviceType, DeviceTypeAdmin)

class ProfileInline(admin.StackedInline):
	model = CustomUser
	can_delete = False
	verbose_name_plural = u'Дополнительные параметры'
	#exclude = ('password', 'name',)
	fields = (#'first_name', 'last_name', 
		'sex', 'residence', 'device', 'description',
		'avatar', 'experience', 'gallery', 'recipes_count',)


class UserAdmin(DjangoAdmin):
	add_fieldsets = (
        (None, {
            'classes': ('wide',),
            'fields': ('username', 'email', 'password1', 'password2')}
        ),
    )
	inlines = (ProfileInline, )

UserAdmin.list_display = ('email', 'first_name', 'last_name', 'username', 'is_staff')

# Re-register UserAdmin
admin.site.unregister(User)
admin.site.register(User, UserAdmin)
